<?php require_once('../../Connections/conexion.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form1")) {
  $updateSQL = sprintf("UPDATE ope_cam SET Nom_OpeCam=%s WHERE Id_OpeCam=%s",
                       GetSQLValueString($_POST['Nom_banco'], "text"),
                       GetSQLValueString($_POST['select'], "int"));

  mysql_select_db($database_conexion, $conexion);
  $Result1 = mysql_query($updateSQL, $conexion) or die(mysql_error());
}

mysql_select_db($database_conexion, $conexion);
$query_Recordset1 = "SELECT * FROM ope_cam WHERE Id_OpeCam = Id_OpeCam";
$Recordset1 = mysql_query($query_Recordset1, $conexion) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Documento sin título</title>
</head>

<body>
<div id="cabezera">
  <h1>Logo</h1>
  <div id="menu">
    <p> Menu </p>
</div>
</div>
<p>&nbsp;</p>
<form action="<?php echo $editFormAction; ?>" id="form1" name="form1" method="POST">
  <div id="contenido2">
    <div id="Titulo2">
      <p>Modificaci&oacute;n de Operador Cambiario  </p>
      <div id="Informacion Operador Cambiario2">
        <div id="tabla3"> Numero de Identidicacion</div>
        <div id="caja de texto3">
          <label for="select"></label>
          <select name="select" id="select">
            <?php
do {  
?>
            <option value="<?php echo $row_Recordset1['Id_OpeCam']?>"<?php if (!(strcmp($row_Recordset1['Id_OpeCam'], $row_Recordset1['Nom_OpeCam']))) {echo "selected=\"selected\"";} ?>><?php echo $row_Recordset1['Id_OpeCam']?></option>
            <?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
  $rows = mysql_num_rows($Recordset1);
  if($rows > 0) {
      mysql_data_seek($Recordset1, 0);
	  $row_Recordset1 = mysql_fetch_assoc($Recordset1);
  }
?>
          </select>
        </div>
        <div class="nofloat"></div>
        <div id="tabla4">Nombre Entidad Bancaria </div>
        <div id="caja de texto4">
          <input name="Nom_banco" type="text" />
        </div>
        <p>&nbsp;</p>
        <p>
          <input type="submit" name="modificar" id="modificar" value="Modificar" />
        </p>
      </div>
      <div class="nofloat">
        <p>&nbsp;</p>
        <p>&nbsp;</p>
      </div>
    </div>
  </div>
  <input type="hidden" name="MM_update" value="form1" />
</form>
<p>&nbsp;</p>
<p></p>
<div id="Evento"></div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>
